/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package ticketmaster.presentation;

import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JFrame;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;
import ticketmaster.businessobject.LoginUser;
import ticketmaster.businessobject.User;

/**
 *
 * @author Wei Liu
 */
public class BaseFrame extends JFrame
{
    private User user;

    public BaseFrame()
    {
        super();
        this.setTitle("Ticket Master");
        this.setResizable(false);

        try
        {
            UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
        }
        catch (ClassNotFoundException ex)
        {
            Logger.getLogger(BaseFrame.class.getName()).log(Level.SEVERE, null, ex);
        }
        catch (InstantiationException ex)
        {
            Logger.getLogger(BaseFrame.class.getName()).log(Level.SEVERE, null, ex);
        }
        catch (IllegalAccessException ex)
        {
            Logger.getLogger(BaseFrame.class.getName()).log(Level.SEVERE, null, ex);
        }
        catch (UnsupportedLookAndFeelException ex)
        {
            Logger.getLogger(BaseFrame.class.getName()).log(Level.SEVERE, null, ex);
        }

	this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
	this.setVisible(true);
    }
    
    /**
     * @return the user
     */
    public User getUser()
    {
        //return LoginUser.getUser();
        if(user == null)
            user = LoginUser.getUser();
        return user;
    }

    /**
     * @param user the user to set
     */
    public void setUser(User user)
    {
        this.user = user;
    }

}
